import config from "@/config"
import http from "@/utils/request"
import { ApiResult } from '@/api/common/ApiResultType'
import { QueryProcessFormDto, ProcessFormSaveDto } from './types'
import PageViewModel from '../common/PageViewType'
export default {
	/**
	 * 获取当前所有数据
	 */
	getlist: {
		url: `${config.API_URL}/ProcessForm/getlist`,
		name: "获取当前所有数据",
		post: async function () {
			var res: PageViewModel = await http.post(this.url);
			return res;
		}
	},
	/**
	 * 获取当前所有表的信息
	 */
	getTableInfos: {
		url: `${config.API_URL}/ProcessForm/getTableInfos`,
		name: "获取当前所有表的信息",
		get: async function () {
			var res: ApiResult = await http.get(this.url);
			return res;
		}
	},
	/**
	 * 获取表单信息
	 */
	getFormInfoByFormId: {
		url: `${config.API_URL}/ProcessForm/getFormInfoByFormId`,
		name: "获取表单信息",
		get: async function (id: string) {
			var res: ApiResult = await http.get(this.url + "?formId=" + id);
			return res;
		}
	},
	/**
	 * 保存数据
	 */
	save: {
		url: `${config.API_URL}/ProcessForm/save`,
		name: "保存数据",
		post: async function (data: any) {
			var res: ApiResult = await http.post(this.url, data);
			return res;
		}
	},
	/**
	 * 根据表名获取字段信息
	 */
	getFieIdByTableName: {
		url: `${config.API_URL}/ProcessForm/GetFieIdByTableName`,
		name: "根据表名获取字段信息",
		get: async function (tableName: any) {
			var res: ApiResult = await http.get(this.url + `?tableName=${tableName}`);
			return res;
		}
	},

}
